from rest_framework import serializers
from .models import reader,publisher,book

# 主表
class ReaderSerializer(serializers.ModelSerializer):
    class Meta:
        model = reader
        fields = ['name','password','email']




# 书籍表

class BookSerializer(serializers.ModelSerializer):
    class Meta:
        model = book
        fields = ['name','status','reader','updatetime']



# 出版社

class PublisherSerializer(serializers.ModelSerializer):
    books=BookSerializer(many=True,read_only=True)
    class Meta:
        model = publisher
        fields = ['name', 'address','books']


